from config.path_manager import initialize_environment
from config.config_loader import load_db_config
from excel.excel_processor import process_all_excel_files

def main():
    try:
        # 初始化环境
        initialize_environment()
        
        # 加载配置
        db_config, batch_size = load_db_config()
        
        # 处理所有Excel文件
        process_all_excel_files(db_config, batch_size)
        
        print("\n" + "="*50)
        print("程序执行完成！")
        print("="*50)
        
    except Exception as e:
        print(f"\n程序执行出错: {e}")
        print("="*50)
    
    finally:
        # 暂停等待用户输入
        input("\n按任意键退出...")

if __name__ == "__main__":
    main()